<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui" >
	
	<!-- 页面间参数传递 -->
	<h:inputHidden value="#{uploadForType}" binding="#{attachUploadMB.uploadForTypeInput}"/>
	<h:inputHidden value="#{uploadForId}" binding="#{attachUploadMB.uploadForIdInput}"/>
	<h:inputHidden value="#{uploadForName}" binding="#{attachUploadMB.uploadForNameInput}"/>
	
	<h:panelGrid  columns="2" cellspacing="10" >
	<h:panelGroup>
		<p:fileUpload fileUploadListener="#{attachUploadMB.handleFileUpload}" 
			mode="advanced" dragDropSupport="false" auto="true"
			label="附件选择" uploadLabel="文件上传" cancelLabel="取消上传"						
			update=":frmAttach"  sizeLimit="10000000" fileLimit="10"
			allowTypes="/(\.|\/)(gif|jpe?g|png|xml|pdf|txt|xls|xlsx|doc|docx|ppt|pptx)$/" 
			invalidFileMessage="不支持的文件类型"/>
	</h:panelGroup>
	<h:panelGroup id="attachFileShow" >
		<p:graphicImage style="width:160px;height:90px;" title="#{attachUploadMB.uploadedFile}" alt="附件图片显示" 
			value="/#{attachUploadMB.uploadedFileImage}" />
	</h:panelGroup>
	<h:panelGroup>
		<p:dataTable id="attachTable" value="#{attachUploadMB.voList}"  var="row"  rowIndexVar="rowNum"
			style="margin-bottom:5px" paginator="true" paginatorPosition="bottom" rows="5"  emptyMessage="没有记录" 
	        rowKey="#{row.id}" selectionMode="single" selection="#{attachUploadMB.selectedAttach}" >
	                
			<p:ajax event="rowSelect" listener="#{attachUploadMB.onRowSelected}" update=":frmAttach:attachFileShow" />		
	
			<p:column headerText="No."  width="20"  >
				#{rowNum+1}
			</p:column>
			<p:column headerText="业务类型" width="80" >
				<h:outputText value="#{row.forType}" />
			</p:column>
			<p:column headerText="业务编号" width="80" >
				<h:outputText value="#{row.forId}" />
			</p:column>
			<p:column headerText="业务名称"  width="80" >
				<h:outputText value="#{row.forName}" />
			</p:column>
			<p:column headerText="附件编号" width="80" >
				<h:outputText value="#{row.id}" />
			</p:column>
			<p:column headerText="附件上传名" width="80" >
				<h:outputText value="#{row.updName}" />
			</p:column>			
		</p:dataTable>
		<h:outputText value="业务类型说明：1-合同2-订单3-发货单-4出库单-5验收单-6请款单" />	
	</h:panelGroup>		
	</h:panelGrid>

</ui:composition>
